Skip to content

Improve nomenclatural_type handling and add API glossary#254

Merged
lmrodriguezr merged 2 commits into
mainfrom
improve-nomenclatural-type-docs-and-code
May 11, 2026
Merged

Improve nomenclatural_type handling and add API glossary#254
lmrodriguezr merged 2 commits into
mainfrom
improve-nomenclatural-type-docs-and-code

Conversation

@lmrodriguezr
Copy link
Copy Markdown
Member

This PR includes two improvements:

  1. Code Improvement: Updated app/views/names/_nomenclatural_type.json.jbuilder to safely handle cases where the object is nil or does not respond to type_of_type. The new logic uses Ruby's safe navigation operator (&.) and respond_to? to ensure robustness, returning 'unknown' as a fallback.

  2. Documentation Improvement: Added a new docs/api_glossary.md file that documents all enums (status_name, kind, rank) and special fields like nomenclatural_type used in the SeqCode Registry API. The nomenclatural_type field is now clearly documented as a hash object with a class key that can have values: Name, Genome, Strain, Other, or unknown. The Other value is included as it is returned by GenericTypeMaterial#type_of_type.

These changes improve both the reliability of the API and the clarity of its documentation.

- Use safe navigation and respond_to? to check if object can call type_of_type
- Return 'unknown' if object is nil or does not respond to type_of_type
- This ensures consistency with the API documentation and handles edge cases gracefully
This file documents all enums (status_name, kind, rank) and special fields
like nomenclatural_type that are used in the SeqCode Registry API.

The nomenclatural_type field is documented as a hash object with a class
key that can have values: Name, Genome, Strain, Other, or unknown.
Other is included as it is returned by GenericTypeMaterial#type_of_type.
@lmrodriguezr lmrodriguezr merged commit 74ec1ee into main May 11, 2026
3 checks passed
@lmrodriguezr lmrodriguezr deleted the improve-nomenclatural-type-docs-and-code branch May 11, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant